pspusbbus.h

Go to the documentation of this file.
00001 /*
00002  * PSP Software Development Kit - http://www.pspdev.org
00003  * -----------------------------------------------------------------------
00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
00005  *
00006  * pspusbbus.h - Prototypes for the sceUsbBus_driver library
00007  *
00008  * Copyright (c) 2006 James F 
00009  *
00010  * $Id: pspusbbus.h 1815 2006-02-26 14:02:04Z tyranid $
00011  */
00012 #ifndef __PSPUSBBUS_H__
00013 #define __PSPUSBBUS_H__
00014 
00016 struct UsbInterface
00017 {
00019         int expect_interface;
00021         int unk8;
00023         int num_interface;
00024 };
00025 
00027 struct UsbEndpoint
00028 {
00030         int endpnum; 
00032         int unk2; 
00034         int unk3;
00035 };
00036 
00038 struct StringDescriptor
00039 {
00040         unsigned char bLength;
00041         unsigned char bDescriptorType;
00042         short bString[32];
00043 } __attribute__((packed));
00044 
00046 struct DeviceDescriptor
00047 {
00048         unsigned char bLength;
00049         unsigned char bDescriptorType;
00050         unsigned short bcdUSB;
00051         unsigned char bDeviceClass;
00052         unsigned char bDeviceSubClass;
00053         unsigned char bDeviceProtocol;
00054         unsigned char bMaxPacketSize;
00055         unsigned short idVendor;
00056         unsigned short idProduct;
00057         unsigned short bcdDevice;
00058         unsigned char iManufacturer;
00059         unsigned char iProduct;
00060         unsigned char iSerialNumber;
00061         unsigned char bNumConfigurations;
00062 } __attribute__((packed));
00063 
00065 struct ConfigDescriptor
00066 {
00067         unsigned char bLength;
00068         unsigned char bDescriptorType;
00069         unsigned short wTotalLength;
00070         unsigned char bNumInterfaces;
00071         unsigned char bConfigurationValue;
00072         unsigned char iConfiguration;
00073         unsigned char bmAttributes; 
00074         unsigned char bMaxPower; 
00075 } __attribute__((packed));
00076 
00078 struct InterfaceDescriptor
00079 {
00080         unsigned char bLength;
00081         unsigned char bDescriptorType;
00082         unsigned char bInterfaceNumber;
00083         unsigned char bAlternateSetting;
00084         unsigned char bNumEndpoints;
00085         unsigned char bInterfaceClass;
00086         unsigned char bInterfaceSubClass;
00087         unsigned char bInterfaceProtocol;
00088         unsigned char iInterface;
00089 } __attribute__((packed));
00090 
00092 struct EndpointDescriptor
00093 {
00094         unsigned char bLength;
00095         unsigned char bDescriptorType;
00096         unsigned char bEndpointAddress;
00097         unsigned char bmAttributes;
00098         unsigned short wMaxPacketSize; 
00099         unsigned char bInterval;
00100 } __attribute__((packed));
00101 
00103 struct UsbInterfaces
00104 {
00106         struct InterfaceDescriptor *infp[2];
00108         unsigned int num;
00109 };
00110 
00112 struct UsbConfiguration
00113 {
00115         struct ConfigDescriptor *confp;
00117         struct UsbInterfaces *infs;
00119         struct InterfaceDescriptor *infp;
00121         struct EndpointDescriptor *endp;
00122 };
00123 
00125 struct UsbData
00126 {
00127         unsigned char devdesc[20];
00128 
00129         struct Config
00130         {
00131                 void *pconfdesc;
00132                 void *pinterfaces;
00133                 void *pinterdesc;
00134                 void *pendp;
00135         } config;
00136         
00137         struct ConfDesc
00138         {
00139                 unsigned char desc[12];
00140                 void *pinterfaces;
00141         } confdesc;
00142 
00143         unsigned char pad1[8];
00144         struct Interfaces
00145         {
00146                 void *pinterdesc[2];
00147                 unsigned int intcount;
00148         } interfaces;
00149 
00150         struct InterDesc
00151         {
00152                 unsigned char desc[12];
00153                 void *pendp;
00154                 unsigned char pad[32];
00155         } interdesc;
00156 
00157         struct Endp
00158         {
00159                 unsigned char desc[16];
00160         } endp[4];
00161 } __attribute__((packed));
00162 
00164 struct DeviceRequest
00165 {
00166         unsigned char bmRequestType;
00167         unsigned char bRequest;
00168         unsigned short wValue;
00169         unsigned short wIndex;
00170         unsigned short wLength;
00171 } __attribute__((packed));
00172 
00174 struct UsbDriver
00175 {
00177         const char *name; 
00179         int endpoints;
00181         struct UsbEndpoint *endp; 
00183         struct UsbInterface *intp;        
00185         void *devp_hi;  
00187         void *confp_hi; 
00189         void *devp;     
00191         void *confp;    
00193         struct StringDescriptor *str; 
00195         int (*recvctl)(int arg1, int arg2, struct DeviceRequest *req);
00197         int (*func28)(int arg1, int arg2, int arg3);  
00199         int (*attach)(int speed, void *arg2, void *arg3); 
00201         int (*detach)(int arg1, int arg2, int arg3);
00203         int unk34;
00205         int (*start_func)(int size, void *args);
00207         int (*stop_func)(int size, void *args);  
00209         struct UsbDriver *link; 
00210 };
00211 
00213 struct UsbdDeviceReq
00214 {
00216         struct UsbEndpoint *endp; 
00218         void *data;
00220         int  size; 
00222         int  unkc; 
00224         void *func;
00226         int  recvsize;
00228         int  retcode; 
00230         int  unk1c;
00232         void *arg;
00234         void *link;
00235 };
00236 
00244 int sceUsbbdRegister(struct UsbDriver *drv);
00245 
00253 int sceUsbbdUnregister(struct UsbDriver *drv);
00254 
00262 int sceUsbbdClearFIFO(struct UsbEndpoint *endp);
00263 
00271 int sceUsbbdReqCancelAll(struct UsbEndpoint *endp);
00272 
00280 int sceUsbbdStall(struct UsbEndpoint *endp);
00281 
00289 int sceUsbbdReqSend(struct UsbdDeviceReq *req);
00290 
00298 int sceUsbbdReqRecv(struct UsbdDeviceReq *req);
00299 
00300 #endif

Generated on Tue Nov 21 11:46:04 2006 for pspsdk-1.0+beta2 by  doxygen 1.4.6